home *** CD-ROM | disk | FTP | other *** search
-
- //------------------------------------------------------------------------------
- // ie.js
- //
- // Common javascript functions for all HTML dialogs.
- //
- //
- // Things every dialog must define:
- //
- // string urlMoreInfo URL the moreinfo link should lead to, required if the link exists
- //
- //
- //
- //------------------------------------------------------------------------------
-
- //------------------------------------------------------------------------------
- // Initializations
- //------------------------------------------------------------------------------
-
- // Disable the right click context menu
- document.oncontextmenu = function(){return false}
-
-
- //------------------------------------------------------------------------------
- // Constants
- //------------------------------------------------------------------------------
-
- // These must all match the constants in DialogDefs.h
-
- // Dialog type constants
- kDialogTypeOK = 0;
- kDialogTypeOKCancel = 1;
- kDialogTypeYesNo = 2;
- kDialogTypeCancel = 3;
- kDialogTypeOKShow = 4;
- kDialogTypeNone = 5;
-
- // Dialog results
- kResultFalse = 0;
- kResultTrue = 1;
- kResultCancel = 2;
- kResultSpecial = 3;
-
- // Check box types
- kDontShowDontAskAgain = 0
- kShowDontAskAgain = 1
- kShowDontShowMoreTips = 2
-
-
- //------------------------------------------------------------------------------
- // Default dialog functions
- //------------------------------------------------------------------------------
-
-
- // Initialize the dialog
- function DlgInit()
- {
- w = window.external.GetWidth();
- document.all.dialogbox.width = w;
- h = document.all.dialogbox.offsetHeight;
- window.external.SetDimensions(w,h);
-
- document.body.focus();
- }
-
-
- // Get a dialog parameter
- function DlgParam(num)
- {
- return window.external.GetNthParam(num);
- }
-
-
- // End the dialog
- function DlgEnd()
- {
- window.external.End(true);
- }
-
-
- // Cancel the dialog
- function DlgCancel()
- {
- window.external.SetResult(0, kResultCancel); // result 0 is ALWAYS the dialog result
- DlgEnd();
- }
-
-
- // OK the dialog
- function DlgOK()
- {
- window.external.SetResult(0, kResultTrue); // result 0 is ALWAYS the dialog result
- if( window.event ) //it's possible to have swallowed the event already (by calling DlgLinkTo, for example)
- window.event.cancelBubble = true;
- DlgEnd();
- }
-
-
- // End the dialog with a "special" result
- function DlgSpecial()
- {
- window.external.SetResult(0, kResultSpecial); // result 0 is ALWAYS the dialog result
- if( window.event ) //it's possible to have swallowed the event already (by calling DlgLinkTo, for example)
- window.event.cancelBubble = true;
- DlgEnd();
- }
-
-
-
- // Handle a mouse down event in the dialog window
- function DlgMouseDown()
- {
- var cancel = true;
-
- var srcElement = window.event.srcElement;
- if (srcElement != null) {
- var tag = srcElement.tagName;
- var type = srcElement.type;
-
- if (tag != null) {
- tag = tag.toLowerCase();
- if (tag == "textarea") {
- cancel = false;
- } else if (tag == "input" && type != null) {
- type = type.toLowerCase();
- if (type == "text" || type == "password")
- cancel = false;
- }
- }
- }
-
- if (cancel) {
- document.selection.empty();
- window.event.cancelBubble = true;
- }
- return true;
- }
-
-
- // Give more info on the dialog
- function DlgMoreInfo()
- {
- if (urlMoreInfo != null)
- window.external.OnHelp(urlMoreInfo);
- }
-
-
- // Open to a new URL
- function DlgLinkTo( URL ){
- window.external.OnHelp( URL );
- //window.open( URL );
- }
-
-